package com.lzj.demo.leetcode;

import org.junit.Test;

import java.util.Scanner;

public class ListNode {
    private int val;
    private ListNode next;
    ListNode(){}
    ListNode(int val){
        this.val = val;
    }

    public ListNode(int val, ListNode next) {
        this.val = val;
        this.next = next;
    }

   public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入一串链表" );
        int i = sc.nextInt();
        System.out.println( "输入第二串链表");
        int n=sc.nextInt();
        System.out.println("结果");

    }
@Test
    public static ListNode mergeTwoLists(ListNode l1, ListNode l2) {
        if (l1 == null) {
            return l2;
        } else if (l2 == null) {
            return l1;
        } else if (l1.val < l2.val) {
            l1.next = mergeTwoLists(l1.next, l2);
            return l1;
        } else {
            l2.next = mergeTwoLists(l2.next, l1);
            return l2;
        }
    }
}